﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WSharp_Editor
{
    public partial class TextEditorSettings : Form
    {
        RichTextBox editorreference;
        public TextEditorSettings(RichTextBox editorRef)
        {
            InitializeComponent();
            editorreference = editorRef;
            cb_wordWrap.SelectedItem = editorreference.WordWrap.ToString();
            cb_zoomFactor.SelectedItem = editorreference.ZoomFactor.ToString();
            cb_fontName.SelectedItem = editorreference.Font.Name.ToString();
            tb_fontsize.Text = editorreference.Font.Size.ToString();
            cb_fontstyle.SelectedItem = editorreference.Font.Style.ToString();
        }

        private void tes_okbtn_Click(object sender, EventArgs e)
        {
            MainForm.t_wordWrap = cb_wordWrap.SelectedItem.ToString();
            MainForm.t_zoomFactor = cb_zoomFactor.SelectedItem.ToString();
            MainForm.t_fontname = cb_fontName.SelectedItem.ToString();
            MainForm.t_fontsize = tb_fontsize.Text;
            MainForm.t_fontstyle = cb_fontstyle.SelectedItem.ToString();
            DialogResult = DialogResult.OK;
            this.Close();
        }

        private void tes_cancelbtn_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
